<?php

get_header();

echo '<div id="content" class="widecolumn">' . "\n\n";

if ( have_posts() )
{
	while ( have_posts() )
	{
		the_post();

		echo '  <div class="navigation">' . "\n";
		echo '    <div class="alignleft">&nbsp;</div>' . "\n";
		echo '		<div class="alignright">&nbsp;</div>' . "\n";
		echo '	</div>' . "\n\n";
		
		// This also populates the iconsize for the next line
		$attachment_link = get_the_attachment_link($post->ID, true, array(450, 800));

    // This lets us style narrow icons specially
		$_post = &get_post($post->ID); $classname = ($_post->iconsize[0] <= 128 ? 'small' : '') . 'attachment';

		echo '  <div class="post" id="post-' . get_the_ID() . '">' . "\n";
		echo '    <h2><a href="' . get_permalink($post->post_parent) . '" rev="attachment">' . get_the_title($post->post_parent) . '</a> &raquo; <a href="' . get_permalink() . '" rel="bookmark" title="';
		printf(__('Permanent Link: %s', 'german_newspaper'), the_title_attribute('echo=0'));
		echo '">' . the_title( '', '', false) . '</a></h2>' . "\n";
		echo '		<div class="entry">' . "\n";
		echo '			<p class="' . $classname . '">' . $attachment_link . '<br />' . basename($post->guid) . '</p>' . "\n";

		the_content('<p class="serif">' . __('Read the rest of this entry &raquo;', 'german_newspaper') . '</p>');
		wp_link_pages(array('before' => '<p><strong>' . __('Pages:', 'german_newspaper') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));

		echo '			<p class="postmetadata alt">' . "\n";
		echo '			<small>' . "\n";
		
						/* This is commented, because it requires a little adjusting sometimes.
							You'll need to download this plugin, and follow the instructions:
							http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
							/* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); $time_since = sprintf(__('%s ago', 'german_newspaper'), time_since($entry_datetime)); */

		printf(__('This entry was posted %1$s on %2$s at %3$s and is filed under %4$s.', 'german_newspaper'), $time_since, get_the_time(__('l, F jS, Y', 'german_newspaper')), get_the_time(), get_the_category_list(', '));
		printf(__(' You can follow any responses to this entry through the <a href="%s"><span class="rss_symbol"></span>RSS 2.0</a> feed.', 'german_newspaper'), get_post_comments_feed_link());

		if (('open' == $post->comment_status) && ('open' == $post->ping_status))
  	{
			// Both Comments and Pings are open
			printf(__(' You can <a href="#respond">leave a response</a>, or <a href="%s" rel="trackback">trackback</a> from your own site.', 'german_newspaper'), get_trackback_url());
    }
		elseif (!('open' == $post->comment_status) && ('open' == $post->ping_status))
		{
			// Only Pings are Open
			printf(__(' Responses are currently closed, but you can <a href="%s" rel="trackback">trackback</a> from your own site.', 'german_newspaper'), get_trackback_url());
    }
		elseif (('open' == $post->comment_status) && !('open' == $post->ping_status))
		{
			// Comments are open, Pings are not
			_e(' You can skip to the end and leave a response. Pinging is currently not allowed.', 'german_newspaper');
    }
		elseif (!('open' == $post->comment_status) && !('open' == $post->ping_status))
		{
			// Neither Comments, nor Pings are open
			_e(' Both comments and pings are currently closed.', 'german_newspaper');
    }

		edit_post_link(__(' Edit this entry.', 'german_newspaper'),'','');

		echo '			</small>' . "\n";
		echo '		</p>' . "\n";
		echo '	</div>' . "\n";
		echo '</div>' . "\n\n";

		comments_template();
	}
}
else
{
	echo '<p>' . __('Sorry, no attachments matched your criteria.', 'german_newspaper') . '</p>' . "\n";
}

echo '</div>' . "\n\n";

get_footer();

?>